<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../js/layui/css/layui.css">
</head>
<body>
	<form class="layui-form"  id="form1">
		<div class="layui-form-item">
			   	<label class="layui-form-label">姓&nbsp;&nbsp;&nbsp;名</label>
				<div class="layui-input-inline">
				   <input type="name" name="name" id="name" required lay-verify="required" placeholder="姓名" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-form-item">
			   	<label class="layui-form-label">手&nbsp;机&nbsp;号</label>
				<div class="layui-input-inline">
				   <input type="phone" name="phone" id="phone" required lay-verify="required" placeholder="手机号" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-form-item">
		   		<label class="layui-form-label">性&nbsp;&nbsp;&nbsp;别</label>
				<div class="layui-input-inline">
				      <select name="sex" id="sex">
				      	<option value="男">男</option>
				      	<option value="女">女</option>
				      </select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">年&nbsp;&nbsp;&nbsp;龄</label>
			<div class="layui-input-inline">
			     <input type="age" name="age" id="age" required lay-verify="required" placeholder="年龄" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">账&nbsp;&nbsp;&nbsp;号</label>
			<div class="layui-input-inline">
			    <input type="account" name="account" id="account" required lay-verify="required" placeholder="账号" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">密&nbsp;&nbsp;&nbsp;码</label>
			<div class="layui-input-inline">
			    <input type="password" name="password" id="password" required lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
			   <button class="layui-btn" type="button" id="subbtn" lay-filter="formDemo">提交</button>	     
			</div>
		</div>
	</div>
	 <input type="hidden" name="id" id="id" >
	</form>
</body>
<script type="text/javascript" src="../js/layui/layui.js"></script>
<script>
	var master=window.parent.master[0];
 	layui.use(['form','layer','jquery'], function(){
		var form = layui.form, 
		$ = layui.jquery, 
		layer = layui.layer;
		$("#password").val(master.password);
		$("#account").val(master.account);
		$("#age").val(master.age);
		$("#phone").val(master.phone);
		$("#name").val(master.name);
		$("#id").val(master.id);
		$(document).on('click','#subbtn',function(){
			$.ajax({
				url : '/master/masterUpd',// 跳转到 action
				type : 'post',
				data :$("#form1").serialize(),
				success : function(data) {
					if(data.code=='200'){
						layer.msg(data.msg,function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index);
							window.parent.location.reload();
						});
					}else {
						layer.msg(data.msg,function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index);
							window.parent.location.reload();
						});
					}

				},
				error : function(error) {
					// view("异常！");  
				}
			});
		});
 	});
</script>
</html>